package com.example.opengldemo._11_;

public class KeyThread extends Thread {

    TextureView mv;
    public static boolean flag = true;
    // ±Ì æ∞¥≈•◊¥Ã¨µƒ≥£¡ø
    public static final int Stop = 0;

    /**
     *           1     10      100
     *  1000   1001    1010     1100
     *  10000  10001   10010    10100
     *  100000 100001  100010   100100
     */
    public static final int up = 1010;
    public static final int down = 100010;
    public static final int left = 10001;
    public static final int right = 10100;

    public static final int into = 10010;
    public static final int outto = 100001;
    public static final int retotex = 1001;
    public static final int retotey = 1100;
    public static final int retotez = 100100;





    public KeyThread(TextureView mv) {
        this.mv = mv;
    }

    public void run() {
        while (flag) {
            if (TextureView.rectState == up) {// …œ
                TextureView.tranY += TextureView.moveSpan;
            }
            else if (TextureView.rectState == down) {// œ¬
                TextureView.tranY -= TextureView.moveSpan;
            }
            else if (TextureView.rectState == left) {// ◊Û
                TextureView.tranX -= TextureView.moveSpan;
            }
            else if (TextureView.rectState == right) {// ”“
                TextureView.tranX += TextureView.moveSpan;

            }else if (TextureView.rectState == into) {// …œ
                TextureView.tranZ += TextureView.moveSpan;
            }
            else if (TextureView.rectState == outto) {// œ¬
                TextureView.tranZ -= TextureView.moveSpan;
            }
            else if (TextureView.rectState == retotex ) {// ◊Û
                TextureView.rotateX += TextureView.moveSpan;
            }
            else if (TextureView.rectState == retotey) {// ”“
                TextureView.rotateY += TextureView.moveSpan;
            }
            else if (TextureView.rectState == retotez) {// ”“
                TextureView.rotateZ += TextureView.moveSpan;
            }
            try {
                Thread.sleep(40);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
